home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 21
/
CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso
/
CUCD
/
Programming
/
RTGMaster
/
demos
/
moon
/
rtggadgets.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-08
|
5KB
|
131 lines
/*
* RTGGadgets.h V1.2
*
* A package to use gadget-like input elements on RTG screens
*
* Copyright © 1996 by Thomas and Hans-Joerg Frieden
* Written by Thomas Frieden
* Technical assistance by Hans-Joerg Frieden
*
* This software may be freely distributed. The copyright remains with
* the copyright holders. For further information, see legal.doc.
* In no way may this software be modified without permission of the
* copyright holders.
*
* This software is provided "as is", and may only be used at your own risk.
* The copyright holder and/or the authors can not be held responible for any
* damage the usage of this software may cause. To put it in other words, we are not
* responsible if your cat dies while using this software.
*
* Version Comment
* --------------------------------------------------------------
* 0.1 Initial Version without custom functions
* 1.0 first full release
* 1.1 Done some renaming to variables and types
* to keep up with the naming sceme (e.g. RTG*)
* 1.2 Added keypress activation of gadgets
*/
#ifndef _RTGGADGETS_H_
#define _RTGGADGETS_H_
struct RTGGadget {
struct RTGGadget *rg_Next; /* Next gadget in chain */
int rg_ID; /* Number of gadget */
int rg_Left; /* Left edge */
int rg_Top; /* Top edge */
int rg_Width; /* Width of hitbox */
int rg_Height; /* Height of hitbox */
int rg_Flags; /* various flags */
int rg_HitPen; /* Pen to use for hitbox */
int rg_DownPen; /* Pen for standard DownRender */
int rg_UpPen; /* Pen for standadr UpRender */
int (*rg_HitTest)(); /* Custom hittest */
void (*rg_HitRender)(); /* Custom rendering function */
void (*rg_DownRender)(); /* Custom pressed rendering function */
void (*rg_UpRender)(); /* Custom released rendering */
APTR rg_UserData; /* User can put data here */
APTR rg_ExtHandle; /* Reserved for future extensions */
char rg_Key; /* If non-zero, this key activates gadget */
};
#define RGADF_HITHILITE 1 /* Hilite if mouse over hitbox */
#define RGADT_LeftEdge TAG_USER + 1 /* These tags set the fields */
#define RGADT_TopEdge TAG_USER + 2 /* in the RTGGadget structure */
#define RGADT_Width TAG_USER + 3
#define RGADT_Height TAG_USER + 4
#define RGADT_Flags TAG_USER + 5
#define RGADT_HitTest TAG_USER + 6
#define RGADT_HitRender TAG_USER + 7
#define RGADT_DownRender TAG_USER + 8
#define RGADT_UpRender TAG_USER + 9
#define RGADT_Force TAG_USER + 10 /* Error if ID is in use */
#define RGADT_HitPen TAG_USER + 11
#define RGADT_UpPen TAG_USER + 12
#define RGADT_DownPen TAG_USER + 13
#define RGADT_UserData TAG_USER + 14
#define RGADT_Key TAG_USER + 15
struct RTGGList {
struct RTGGadget *gl_First; /* First gadget of this screen */
struct RtgScreen *gl_Screen; /* Pointer to this screen */
int gl_Buffer; /* Number of buffer to draw into */
struct RTGGadget *gl_Hit; /* Pointer to gadget mouse is pointing to */
struct RTGGadget *gl_Selected; /* Selected Gadget */
BOOL gl_Mode; /* TRUE means mouse button is down */
int gl_Flags; /* various flags */
struct RTGGadget *gl_Reset; /* Reset this gadget to up */
};
typedef struct {
UBYTE MK1, MK2, MK3;
UBYTE UK1, UK2, UK3;
UBYTE LastKey;
UBYTE Keys[0x60];
WORD MouseX, MouseY;
} RTGInpRec; /*, *Inp; */
extern struct MsgPort * RTGInputMsgPort;
extern struct IOStdReq * RTGInputIO;
extern struct Interrupt InputHandler;
extern RTGInpRec RTGInputRecord;
/* OA 07_10_96 extern struct Device *ConsoleDevice; */
extern struct IOStdReq RTGConsoleIO;
extern struct InputEvent RTGIe;
extern struct TagItem mtag[3];
extern struct TagItem ctag[3];
/*
* Prototypes
*
* The functions in this package use the RTG (pre|suf)fix.
* Note that this is all caps to tell that these functions do
* not belong to the rtmaster.library, but are used in a
* package for the library.
*
*/
struct RTGGList * CreateRTGGList(struct RtgScreen * , int );
int CreateRTGGadgetA(struct RTGGList * , int , struct TagItem * );
int __stdargs CreateRTGGadget(struct RTGGList * , int , Tag , ...);
int DeleteRTGGadget(struct RTGGList * , int );
int RTGGHitTest(struct RTGGadget * , int , int );
void DrawRTGBox(struct RtgScreen * , APTR , int , int , int , int , char );
void RTGGHitRender(struct RTGGList * , struct RTGGadget * );
void RTGGDownRender(struct RTGGList * , struct RTGGadget * );
void RTGGUpRender(struct RTGGList * , struct RTGGadget * );
void RefreshRTGGList(struct RTGGList * );
BOOL DeleteRTGGList(struct RTGGList * , BOOL );
void RTGGAddIPH(void);
void RTGGRemIPH(void);
BOOL RTGGOpenInput(void);
void RTGGCloseInput(void);
void DrawRTGGList(struct RTGGList * );
#endif /* _RTGGADGETS_H_ */